package mx.edu.itesm.daai.tour;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.ServletConfig;

/**
 * TourOficinasServlet returns a tour of the Offices Buildings in ITESM CCM
 *
 * @author Shadow X-tar
 */
public class TourAulasServlet extends HttpServlet
{
    private TourGenerator tour;

     /**
     * Inicializa el servlet y el Generador de Tours.
     * @return 
     */
      public void init(ServletConfig config) throws ServletException {
                super.init(config);
                this.tour= new TourGenerator();
      }

    /**
     * Redirecciona todas las llamadas de GET como si fueran POST
     * @return 
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
	{
	    doPost(request, response);
	}
    
    /**
     * Método accionado por POST que llama al generador de tours de Aulas
     * @return 
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
	{
	    response.setContentType("application/keyhole");
	    PrintWriter out = response.getWriter();
	    out.println(tour.aulas());
	}

}